home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / a-nuflra.ads < prev    next >
Text File  |  1996-01-30  |  2KB  |  60 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --            A D A . N U M E R I C S . F L O A T _ R A N D O M             --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.7 $                              --
  10. --                                                                          --
  11. -- This specification is adapted from the Ada Reference Manual for use with --
  12. -- GNAT.  In accordance with the copyright of that document, you can freely --
  13. -- copy and modify this specification,  provided that if you redistribute a --
  14. -- modified version,  any changes that you have made are clearly indicated. --
  15. --                                                                          --
  16. ------------------------------------------------------------------------------
  17.  
  18. with Ada.Numerics.Random;
  19. with Ada.Finalization;
  20.  
  21. package Ada.Numerics.Float_Random is
  22.  
  23.    --  Basic facilities
  24.  
  25.    type Generator is limited private;
  26.  
  27.    subtype Uniformly_Distributed is Float range 0.0 .. 1.0;
  28.    function Random (Gen : Generator) return Uniformly_Distributed;
  29.  
  30.    procedure Reset (Gen : in Generator; Initiator : in Integer);
  31.    procedure Reset (Gen : in Generator);
  32.  
  33.    --  Advanced facilities
  34.  
  35.    type State is private;
  36.  
  37.    procedure Save  (Gen : in Generator; To_State   : out State);
  38.    procedure Reset (Gen : in Generator; From_State : in  State);
  39.  
  40.    Max_Image_Width : constant := Ada.Numerics.Random.Max_Image_Width;
  41.  
  42.    function Image (Of_State    : State)  return String;
  43.    function Value (Coded_State : String) return State;
  44.  
  45. private
  46.    package ANR renames Ada.Numerics.Random;
  47.  
  48.    type State is new ANR.State;
  49.  
  50.    type Access_State is access ANR.State;
  51.  
  52.    type Generator is
  53.       new Ada.Finalization.Limited_Controlled with record
  54.          State : Access_State := new ANR.State'(ANR.Make_State);
  55.       end record;
  56.  
  57.    procedure Finalize (Gen : in out Generator);
  58.  
  59. end Ada.Numerics.Float_Random;
  60.